<template>
	<view class="content">
		<view class="loading">
			<view class="logo">

			</view>
			<view class="loading-box">
				<view class="line">

				</view>
			</view>
			<text class="jiazai">加载中··· ···</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		onLoad() {
			this.getCode()
		},
		methods: {
			getCode() {
				const url = 'https://open.weixin.qq.com/connect/oauth2/authorize?' +
					'appid=wxd1f11eba5635d9d7' +
					'&redirect_uri=' + encodeURIComponent('http://redblue.v2code.cn/pages/loginbefore/loginbefore') +
					'&response_type=code' +
					'&scope=snsapi_userinfo' +
					'&state=STATE&connect_redirect=1#wechat_redirect';
				location.href = url
			},
			/* getCode() {
				if (uni.getStorageSync('isLogin')) {
					setTimeout(() => {
						uni.navigateTo({
							url: '../login/login'
						})
					}, 2000)
				} else {
					uniCloud.callFunction({
						name: 'zhuce'
					}).then(res => {
						console.log('注册完成', res)
						uni.setStorageSync('userInfo', res.result.data[0])
						uni.setStorageSync('isLogin', 1)
						uni.setStorageSync('openid', res.result.data[0]._id)
						setTimeout(() => {
							uni.navigateTo({
								url: '../login/login'
							})
						}, 2000)

					})


				}
			} */

		}
	}
</script>

<style lang="scss" scoped>
	page {
		background: #d2d2d2;
		height: 100%;
	}

	.loading {
		width: 100%;
		height: 100%;
		background: url('@/static/kuang.png') no-repeat center center;
		background-size: 100% 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		// margin-top: 136rpx;
	}

	.logo {
		width: 666rpx;
		height: 46rpx;
		background: url('@/static/logo.png') no-repeat center center;
		background-size: 100% 100%;
		margin-top: 60rpx;
	}

	.loading-box {
		width: 386rpx;
		height: 46rpx;
		border-radius: 23rpx;
		overflow: hidden;
		margin-top: 530rpx;
		border: 1px solid #777777;

		.line {
			height: 100%;
			background: linear-gradient(90deg, #046ff9, #dd0419);
			animation: donghua 2s linear infinite;
			border-radius: 23rpx;
			border: 1px solid #898989;
		}
	}

	.jiazai {
		font-size: 32rpx;
		color: #dd1914;
		font-weight: bold;
		word-spacing: 2px;
		letter-spacing: 2px;
		margin-top: 54rpx;
	}

	@keyframes donghua {
		0% {
			width: 0%;
		}

		50% {
			width: 50%;
		}

		100% {
			width: 100%;
		}
	}
</style>
